import request from '@/utils/request'

// 封禁用户
export function banUser(id) {
  return request({
    url: `/admin/users/${id}/ban`,
    method: 'put'
  })
}

// 解封用户
export function unbanUser(id) {
  return request({
    url: `/admin/users/${id}/unban`,
    method: 'put'
  })
}

// 添加分类
export function addCategory(data) {
  return request({
    url: '/admin/categories',
    method: 'post',
    data
  })
}

// 修改分类
export function updateCategory(id, data) {
  return request({
    url: `/admin/categories/${id}`,
    method: 'put',
    data
  })
}

// 删除分类
export function deleteCategory(id) {
  return request({
    url: `/admin/categories/${id}`,
    method: 'delete'
  })
}

// 删除帖子（管理员）
export function deletePost(id) {
  return request({
    url: `/admin/posts/${id}`,
    method: 'delete'
  })
}
